﻿<?php

session_start();
error_reporting(0);
if(empty($_SESSION['username'])||($_SESSION['username']!="管理员"))
{
	echo "<script language=JavaScript>alert('您无权访问该页面!'); window.location='index.php';</script>";
}
include 'common.php';
include 'conn.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>考试登记</title>
<meta name="author" content="Codrops" />
<!-- jquery js -->
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript"  src="js/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- end -->
<!-- 以下部分是menu需要的css 和js -->

<script type='text/javascript' src='js/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='js/jquery.dcmegamenu.1.3.3.js'></script>
<!-- end  -->
<link rel="shortcut icon" href="../favicon.ico">
<link rel='stylesheet' type='text/css' href='css/jquery.kwicks.css' />
<!-- local page css -->
<link rel="stylesheet" type="text/css" href="css/jiemian.css"/>


<script src="js/modernizr.custom.63321.js"></script>
<script type="text/javascript">
$(function() {
	$( "#datepicker" ).datepicker(
			{
			 showOn: "button",
			 buttonImage: "images/calendar.gif",
			 buttonImageOnly: true,
			 dateFormat:"yy-mm-dd"
			} );
	});
	</script>

<!--[if lte IE 7]><style>.main{display:none;} .support-note .note-ie{display:block;}</style>
<![endif]-->
<!-- 放到head.php中
 <script type="text/javascript">
 $(document).ready(function($){
	 $('#mega-menu-9').dcMegaMenu({
			rowItems: '3',
			speed: 'fast',
			effect: 'fade'
		});
 });
 </script>
   -->
 <!--  取消tooltip 
 <script>

$(function() {
$( document ).tooltip();
//mega menu codes:

});
</script>
-->
<script>
function check()
{
	
	if($("#exam_name").val()==""||$("#datepicker").val()==""||$("#select").val()=="")
	{
		alert("请填写完整！");
		return false;
	}
	$("#exam_category").val($("#select").val());
}
	</script>
<style>
label {
display: inline-block;
width: 5em;
}
</style>
<style type='text/css'>
			.kwicks {
				width: 515px;
				height: 100px;
			}
			.kwicks > a {
				width: 125px;
				height: 100px;
				/* overridden by kwicks but good for when JavaScript is disabled */
				margin-left: 5px;
				float: left;
			}

			#panel-1 { background-color: #53b388; }
			#panel-2 { background-color: #5a69a9; }
			#panel-3 { background-color: #c26468; }
			#panel-4 { background-color: #bf7cc7; }
		</style>
</head>
<body>



<div class="container">
<div class="nav_header">
	
	<?php  include 'head.php';?>
	
	</div>
	<div class="main_cj_content">	

<p class="welcome"><?php echo $_SESSION['username']; ?>,欢迎您,请填写下表登记考试信息:</p><hr>
<br />
<br />
<fieldset>
<legend>考试登记</legend>
<form action="" method="post"><br />
<label>考试名称：</label><input style="width:400px" type="text" id="exam_name" name="exam_name"/><br /><br />
<label>考试日期：</label><input type="text" id="datepicker" name="datepicker"/><br /><br />
<label>考试类型：</label>
<select id="select">
<option value=1>全校统考</option>
<option value=2>班级考试</option>
<option value=3>全县统考</option></select>&nbsp; &nbsp;<input type="hidden" id="exam_category" name="exam_category"/>
<input type="submit" value="提交" onclick="return check()"/>
</form>

</fieldset>
<?php 
	if($_POST['exam_name']&&$_POST['datepicker']&&$_POST['exam_category'])
	{
		$exam_name=getpost('exam_name');
		$exam_date=getpost('datepicker');
		$exam_category=getpost('exam_category');
		
		//echo $exam_category;
		$exe="insert into exams(exam_description,exam_date,exam_category) values('".$exam_name."','".$exam_date."',$exam_category)";
		//echo $exe;
		$rs=mysql_query($exe);
		
		if($rs)
		{
			$select="select id from exams where exam_description='".$exam_name."'";
			//echo $select;
			$rs=mysql_query($select);
			$row=mysql_fetch_array($rs);
			$id=$row['id'];
			echo "<br /><p>登记成功!本次考试ID为<b style='color:red'>[$id]</b>,请导入考试成绩</p>";
		}
		//$row=mysql_fetch_array($rs);
		
	}
	?>
	</div>
	
	</body>
	</html>
	
	